import { Component, OnInit } from '@angular/core';
import {AxiosService}  from '../../services/axios.service';
@Component({
  selector: 'app-axios',
  templateUrl: './axios.component.html',
  styleUrls: ['./axios.component.less']
})
export class AxiosComponent implements OnInit {
  public axios;
  constructor(axios:AxiosService) {
    this.axios = axios;
   }
  //简写
  // constructor(public axios:AxiosService) { }
  ngOnInit(): void {
    //  this.getInfo();  //get
  }

  getInfo(){
    this.axios.getFun('/api/school',{name:'alice'}).then((res)=>{
      console.log(res)
    })
  }

  postInfo(){
    this.axios.postFun('/api/info',{name:'laney'}).then((res)=>{
      console.log(res)
    })
  }

}
